<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>

<s:layout-render name="/rozvrh.jsp" nadpis="Knihy">
    <s:layout-component name="telo">
        <s:useActionBean beanclass="cz.muni.makub.web.BooksActionBean" var="actionBean"/>
        Všechny knihy:
        <table class="zakladni">
            <tr>
                <th>id</th>
                <th>autor</th>
                <th>název</th>
                <th>paperback</th>
                <th>barva</th>
                <th>cena</th>
                <th></th>
                <th></th>
            </tr>
            <c:forEach items="${actionBean.books}" var="book">
                <tr>
                    <td>${book.id}</td>
                    <td><c:out value="${book.author}"/></td>
                    <td><c:out value="${book.name}"/></td>
                    <td><c:out value="${book.paperback}"/></td>
                    <td><f:message key="Color.${book.color}"/></td>
                    <td><c:out value="${book.price}"/></td>
                    <td><s:link beanclass="cz.muni.makub.web.BooksActionBean" event="delete"><s:param name="book.id" value="${book.id}"/>smazat</s:link> </td>
                    <td><s:link beanclass="cz.muni.makub.web.BooksActionBean" event="edit"><s:param name="book.id" value="${book.id}"/>edit</s:link> </td>
                </tr>
            </c:forEach>
        </table>
        <s:form beanclass="cz.muni.makub.web.BooksActionBean">
            <fieldset><legend>Nová kniha</legend>
                <%@include file="form.jsp"%>
            <s:submit name="add">Vytvořit novou knihu</s:submit>
            </fieldset>
        </s:form>
    </s:layout-component>
</s:layout-render>